import axios from 'axios'

const instance=axios.create({
    // baseURL:'https://www.fastmock.site/mock/ae8e9031947a302fed5f92425995aa19/jd',
    baseURL:'http://localhost:3000',
    withCredentials:true,
    timeout:10000,
});
// 设置get方法为axios.get
export const get=(url,params={})=>{
    return instance.get(url,{params}).then((res)=>{
        return (res.data)
    }).catch((err) => {
        return (err);
    })
}
// 设置post方法为axios.post
export const post = (url, data) => {
    return instance.post(url, data, {
        header: {
            'Content-Type': 'application/json',
        }
    }).then((res) => {
        return (res.data);
    }).catch((err) => {
        return (err);
    })
}